<template>
	<view>
		<swiper indicator-dots autoplay :interval="3000" :duration="1000" circular :style="getStyles">
			<block v-for="(item,index) in resdata" :key="index">
				<swiper-item>
					<view class="swiper-item" @tap="event(item,index)">
						<image :src="item.src" 
						lazy-load
						:style="getStyles"></image>
					</view>
				</swiper-item>
			</block>
		</swiper>
	</view>
</template>

<script>
	export default {
		props:{
			resdata:Array,
			height:{
				type:String,
				default:'350'
			},
			// 是否是预览
			isPreview:{
				type:Boolean,
				default:false
			}
		},
		computed:{
			getStyles() {
				return `height:${this.height}rpx`
			},
			getListUrls() {
				return this.resdata.map(item => item.src)
			}
		},
		methods:{
			event(item,index){
				if(this.isPreview) {
					uni.previewImage({
						current:index,
						urls:this.getListUrls,
						indicator:"default"
					})
				}
			}
		}
	}
</script>

<style>
</style>
